package io.github.wanggit.antrpc.commons.bean;

import io.github.wanggit.antrpc.commons.utils.JsonUtils;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

public class ConfigItemData implements Serializable {

    private static final long serialVersionUID = 8636988607174726486L;

    private String key;

    private String value;

    /** 灰度发布的节点，如果为空，表示所有节点同时发布，如果指定了IP:port，那么就指定的节点生效 */
    private List<String> grayReleases = new ArrayList<>();

    private Long ts;

    public static ConfigItemData from(byte[] datas) {
        return JsonUtils.fromJson(datas, ConfigItemData.class);
    }

    public static byte[] toBytes(ConfigItemData configItemData) {
        return JsonUtils.toJsonBytes(configItemData);
    }

    public String getKey() {
        return key;
    }

    public void setKey(String key) {
        this.key = key;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public Long getTs() {
        return ts;
    }

    public void setTs(Long ts) {
        this.ts = ts;
    }

    public List<String> getGrayReleases() {
        return grayReleases;
    }

    public void setGrayReleases(List<String> grayReleases) {
        this.grayReleases = grayReleases;
    }
}
